const app = getApp();
Page({
  onLoad(options) {
    let { roomid ='' } = options;
    this.getVideoList(roomid);
  },

  getVideoList(roomid) {
    app.util.request({
      url: 'entry/wxapp/tic',
      data: {
        op: 'getTeacherRecord',
        roomid,
      },
      module: 'cm_onlineclass',
      method: 'get',
      cachetime: 0,
      success: res => {
        let fileSet = res.data.data&&res.data.data.list||[];
        this.setData({
          videoList: fileSet,
          defaultVideo: fileSet[0],
        });
      }, 
    });
  },

  playhistory(e) {
    let { id } = e.currentTarget.dataset;
    const { videoList } = this.data;
    id && this.setData({
      defaultVideo: videoList.find(item => item.id === id) || {},
    });
  },
});